<?php
class Version
{
	/**
     * @return void
     */
    public static function runInstall()
    {
		$str = include SCRIPTS_PATH . '/install.php';
		$sqlCommands = ActiveRecord::extractSqlCommands($str);
		foreach ($sqlCommands as $sqlCommand){
			Yii::app()->main->setActive(true);
			Yii::app()->main->createCommand($sqlCommand)->execute();
		}
    }

    /**
     * @return bool
     */
    public  static function isAppInstalled()
    {
		Yii::app()->main->setActive(true);
        return (bool) Yii::app()->main
			->createCommand("SHOW TABLES")->queryAll();
    }
}